<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>

        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
        }
        h1 {
            color: #333;
            text-align: center;
        }
        form {
            background-color: white;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 500px;
            margin: 0 auto;
        }
        table {
            width: 100%;
            border-collapse: collapse;
        }
        td {
            padding: 10px;
        }
        input[type="text"], select {
            width: 100%;
            padding: 8px;
            border: 1px solid #ccc;
            border-radius: 3px;
        }
        input[type="submit"], input[type="button"] {
            background-color: #4CAF50;
            color: white;
            padding: 10px 15px;
            border: none;
            border-radius: 3px;
            cursor: pointer;
        }
        input[type="submit"]:hover, input[type="button"]:hover {
            background-color: #45a049;
        }
        select {
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="7"><path d="M0 0l5 5 5 -5z" fill="%23333"/></svg>');
            background-repeat: no-repeat;
            background-position: right 8px center;
            padding-right: 20px;
        }
    </style>

</head>
<body>
<h1 align="center">修改物联设备信息</h1>
<p th:text="${msg}" align="center"></p>
<form th:action="@{/doUpdate}" action="/doUpdate" method="post">
    <input type="hidden" name="deviceId" th:value="${iotDevices.deviceId}">
    <table align="center">
        <tr>
            <td>设备名称</td>
            <td><input name="deviceName" required="required" th:value="${iotDevices.deviceName}"> </td>
        </tr>
        <tr>
            <td>设备制造商</td>
            <td><input name="manufacturer" required="required" th:value="${iotDevices.manufacturer}"> </td>
        </tr>
        <tr>
            <td>型号</td>
            <td><input name="model" required="required" th:value="${iotDevices.model}"> </td>
        </tr>
        <tr>
            <td>安装日期</td>
            <td><input name="installationDate" required="required" th:value="${#dates.format(iotDevices.installationDate,'yyyy-MM-dd')}"> </td>
        </tr>
        <tr>
            <td>最后维护日期</td>
            <td><input name="lastMaintenanceDate" required="required" th:value="${#dates.format(iotDevices.lastMaintenanceDate,'yyyy-MM-dd')}"> </td>
        </tr>
        <tr>
            <td>设备位置</td>
            <td><input name="location" required="required" th:value="${iotDevices.location}"> </td>
        </tr>
        <tr>
            <td>设备IP地址</td>
            <td><input name="ip" required="required" th:value="${iotDevices.ip}"> </td>
        </tr>
        <tr>
            <td>设备状态</td>
            <td>
            <select name="status" required="required">
                <option th:selected="${iotDevices.status eq 0}" value="0">离线</option>
                <option th:selected="${iotDevices.status eq 1}" value="1">在线</option>
                <option th:selected="${iotDevices.status eq 2}" value="2">维护中</option>
            </select>
            </td>
        </tr>
        <tr>
            <td>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="submit" align="center" value="修改">
            </td>
            <td>
                <input type="button" align="center" id="fh" value="返回">
            </td>
        </tr>
    </table>
</form>
</body>
</html>
<script src="/webjars/jquery/3.5.1/dist/jquery.min.js"></script>
<script>
$(function () {
    $("#fh").click(function () {
        window.location.href="list"
    })
})
</script>